//填充周函数
export const getWeek = (days) => {
  const weeks = []
  if (days.value[2].week == 1) {
    weeks.push('今天', '明天', '周一', '周二')
  } else if (days.value[2].week == 2) {
    weeks.push('今天', '明天', '周二', '周三')
  } else if (days.value[2].week == 3) {
    weeks.push('今天', '明天', '周三', '周四')
  } else if (days.value[2].week == 4) {
    weeks.push('今天', '明天', '周四', '周五')
  } else if (days.value[2].week == 5) {
    weeks.push('今天', '明天', '周五', '周六')
  } else if (days.value[2].week == 6) {
    weeks.push('今天', '明天', '周六', '周日')
  } else {
    weeks.push('今天', '明天', '周日', '周一')
  }
  return weeks
}

//charts配置项函数
export const renderOption = (daytemp, nighttemp) => {
  const option = {
    xAxis: {
      type: 'category',
      show: false,
    },
    yAxis: {
      type: 'value',
      show: false,
    },
    grid: {
      top: '50px',
      left: 0,
      right: 0,
      bottom: 0,
    },
    series: [
      {
        data: daytemp,
        type: 'line',
        smooth: true,
        label: {
          show: true,
          color: '#fff',
          formatter: '白{c}°C',
        },
      },
      {
        data: nighttemp,
        type: 'line',
        smooth: true,
        label: {
          show: true,
          color: '#fff',
          formatter: '晚{c}°C',
        },
      },
    ],
  }
  return option
}
